package Team.View.MainFrame;

import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Font;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JEditorPane;
import javax.swing.JFormattedTextField;

import javax.swing.JScrollPane;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.JTextPane;
import javax.swing.UIManager;

import javax.swing.BorderFactory;
import javax.swing.border.*;
import javax.swing.table.AbstractTableModel;
import java.awt.Dimension;

import javax.swing.*;

import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import Team.View.MainFrame.*;

import com.jgoodies.forms.factories.DefaultComponentFactory;

public class TeamMainFrameView 
{
	public JTextArea questionTextArea;
	public JComboBox questionProblemcomboBox;
	public JComboBox languageComboBox;
	public JComboBox problemComboBox;
	public JFrame frame;
	public JLabel filePathLabel;
	public JButton selectButton;
	public JButton submitButton;
	public JButton submitQuestionButton;

	/**
	 * Launch the application
	 * @param args
	 */
	public static void main(String args[]) 
	{
		
		try
		{
		    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
		
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					TeamMainFrameView window = new TeamMainFrameView();
					window.frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application
	 */
	public TeamMainFrameView() 
	{
		try
		{
		    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
		
		createContents();
		
		frame.setVisible(true);
	}

	/**
	 * Initialize the contents of the frame
	 */
	private void createContents() 
	{
		frame = new JFrame();
		frame.getContentPane().setLayout(null);
		frame.setTitle("Team Login System");
		frame.setBounds(100, 100, 771, 527);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		final JLabel statusLabel = new JLabel();
		statusLabel.setForeground(new Color(255, 0, 0));
		statusLabel.setFont(new Font("", Font.PLAIN, 14));
		statusLabel.setText("Status");
		statusLabel.setBounds(10, 10, 92, 26);
		frame.getContentPane().add(statusLabel);

		final JLabel stoppedLabel = new JLabel();
		stoppedLabel.setFont(new Font("", Font.BOLD, 12));
		stoppedLabel.setForeground(new Color(255, 0, 0));
		stoppedLabel.setText("Stopped");
		stoppedLabel.setBounds(64, 12, 92, 22);
		frame.getContentPane().add(stoppedLabel);

		final JLabel teamMainFrameLabel = new JLabel();
		teamMainFrameLabel.setForeground(new Color(255, 0, 0));
		teamMainFrameLabel.setFont(new Font("", Font.PLAIN, 18));
		teamMainFrameLabel.setText("Team Main Frame");
		teamMainFrameLabel.setBounds(261, 0, 181, 36);
		frame.getContentPane().add(teamMainFrameLabel);

		final JTabbedPane tabbedPane = new JTabbedPane();
		tabbedPane.setBounds(0, 42, 763, 453);
		frame.getContentPane().add(tabbedPane);

		final JPanel codeSubmitPane = new JPanel();
		codeSubmitPane.setLayout(null);
		tabbedPane.addTab("CodeSubmit", null, codeSubmitPane, null);
		
		ProblemPane problemPane = new ProblemPane();
		problemPane.setLayout(null);
		problemPane.setBounds(35, 35, 188, 100);
	
		codeSubmitPane.add(problemPane);

		final JLabel selectProblemLabel = new JLabel();
		selectProblemLabel.setText("SelectProblem");
		selectProblemLabel.setBounds(10, 47, 91, 15);
		problemPane.add(selectProblemLabel);

		problemComboBox = new JComboBox();
		problemComboBox.setBounds(3, 79, 180, 21);
		problemPane.add(problemComboBox);
		
		
		LanguagePane languagePane = new LanguagePane();
		languagePane.setLayout(null);
		
		languagePane.setBounds(345, 35, 185, 100);
		codeSubmitPane.add(languagePane);

		final JLabel selectlanguageLabel = new JLabel();
		selectlanguageLabel.setText("SelectLanguage");
		selectlanguageLabel.setBounds(10, 44, 85, 15);
		languagePane.add(selectlanguageLabel);

		languageComboBox = new JComboBox();
		languageComboBox.setBounds(3, 78, 179, 22);
		languagePane.add(languageComboBox);
		
		
		FilePathPane filePathPane = new FilePathPane();
		filePathPane.setLayout(null);
		
		filePathPane.setBounds(35, 169, 369, 57);
		codeSubmitPane.add(filePathPane);

		filePathLabel = new JLabel();
		
		filePathLabel.setText("null");
		
		filePathLabel.setBounds(10, 29, 359, 28);
		filePathPane.add(filePathLabel);
		
		selectButton = new JButton();
		selectButton.setText("Select");
		selectButton.setBounds(424, 203, 106, 23);
		codeSubmitPane.add(selectButton);

		final JButton testButton = new JButton();
		testButton.setText("Test");
		testButton.setBounds(35, 311, 99, 23);
		codeSubmitPane.add(testButton);

		submitButton = new JButton(); 
		submitButton.setText("Submit");
		submitButton.setBounds(424, 311, 106, 23);
		codeSubmitPane.add(submitButton);
		
		ViewRunsTablePane viewRunsPanel = new ViewRunsTablePane();
		viewRunsPanel.setLayout(new GridLayout(1, 1));
		tabbedPane.addTab("ViewRuns", null, viewRunsPanel, null);
   

		final JPanel questionSubmitPane = new JPanel();
		questionSubmitPane.setLayout(null);
		tabbedPane.addTab("QuestionSubmit", null, questionSubmitPane, null);
		ProblemPane questionProblemPane = new ProblemPane();
		questionProblemPane.setLayout(null);
		questionProblemPane.setBounds(10, 10, 176, 106);
		questionSubmitPane.add(questionProblemPane);

		final JLabel selectquestionLabel = new JLabel();
		selectquestionLabel.setText("SelectProblem");
		selectquestionLabel.setBounds(10, 44, 125, 26);
		questionProblemPane.add(selectquestionLabel);

		questionProblemcomboBox = new JComboBox();
		questionProblemcomboBox.setBounds(0, 85, 176, 21);
		questionProblemPane.add(questionProblemcomboBox);
		
		QuestionPane questionPane = new QuestionPane();
		questionPane.setLayout(null);
		questionPane.setBounds(10, 135, 738, 241);
		questionSubmitPane.add(questionPane);

		final JScrollPane scrollPane = new JScrollPane();
		scrollPane.setBounds(0, 22, 738, 219);
		questionPane.add(scrollPane);

		questionTextArea = new JTextArea();
		scrollPane.setViewportView(questionTextArea);

		submitQuestionButton = new JButton();
		submitQuestionButton.addActionListener(new ActionListener() {
			public void actionPerformed(final ActionEvent e) {
			}
		});
		submitQuestionButton.setText("SubmitQuestion");
		submitQuestionButton.setBounds(10, 382, 117, 23);
		questionSubmitPane.add(submitQuestionButton);
		
		
		ViewAnswersPane viewAnswersPanel = new ViewAnswersPane();
		viewAnswersPanel.setLayout(new GridLayout(1, 1));
		tabbedPane.addTab("ViewAnswers", null, viewAnswersPanel, null);
		

		final JPanel aboutPane = new JPanel();
		aboutPane.setLayout(null);
		tabbedPane.addTab("About", null, aboutPane, null);
	}
}
